import java.util.HashSet;

public class Polynom {
	HashSet<Monom> monoms;
	
	public Polynom(){
		this.monoms = new HashSet<Monom>();
	}
	
	public Polynom(Monom m){
		this.monoms = new HashSet<Monom>();
		this.monoms.add(m);
	}
	
	public Polynom(HashSet<Monom> mSet){
		this.monoms = mSet;
	}
	
	public void addMonom(Monom monom) {
		monoms.add(monom);
	}

	public Complex calcPolynom(int i, int size) {
		Complex sum = new Complex();
		for (Monom m : monoms) {
			Complex c = Complex.Chi(m.getPower(), i, size);
			Complex temp = Complex.multNew(c, m.getCoefficient());
			sum.add(temp);
		}
		return sum;
	}

}